<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 12">
<meta name=Originator content="Microsoft Word 12">
<link rel=File-List href="containers_files/filelist.xml">
<title>C++Script Manual</title>
<link rel=themeData href="containers_files/themedata.thmx">
<link rel=colorSchemeMapping href="containers_files/colorschememapping.xml">
<!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:TrackMoves>false</w:TrackMoves>
  <w:TrackFormatting/>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:DoNotPromoteQF/>
  <w:LidThemeOther>EN-GB</w:LidThemeOther>
  <w:LidThemeAsian>X-NONE</w:LidThemeAsian>
  <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
   <w:SplitPgBreakAndParaMark/>
   <w:DontVertAlignCellWithSp/>
   <w:DontBreakConstrainedForcedTables/>
   <w:DontVertAlignInTxbx/>
   <w:Word11KerningPairs/>
   <w:CachedColBalance/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
  <m:mathPr>
   <m:mathFont m:val="Cambria Math"/>
   <m:brkBin m:val="before"/>
   <m:brkBinSub m:val="&#45;-"/>
   <m:smallFrac m:val="off"/>
   <m:dispDef/>
   <m:lMargin m:val="0"/>
   <m:rMargin m:val="0"/>
   <m:defJc m:val="centerGroup"/>
   <m:wrapIndent m:val="1440"/>
   <m:intLim m:val="subSup"/>
   <m:naryLim m:val="undOvr"/>
  </m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267">
  <w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
  <w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
  <w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 2"/>
  <w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 3"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 1"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 2"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 3"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 4"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 5"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 6"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 7"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 8"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 9"/>
  <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
  <w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/>
  <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
  <w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
  <w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
  <w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
  <w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/>
  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
  <w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
  <w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
  <w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
  <w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
  <w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
  <w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
  <w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
  <w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
  <w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
  <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
  <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
 </w:LatentStyles>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Cambria;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073741899 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:modern;
	mso-font-pitch:fixed;
	mso-font-signature:-1610611985 1073750091 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";}
h1
	{mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-link:"Heading 1 Char";
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	mso-outline-level:1;
	font-size:24.0pt;
	font-family:"Cambria","serif";
	mso-ascii-font-family:Cambria;
	mso-ascii-theme-font:major-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Cambria;
	mso-hansi-theme-font:major-latin;
	font-weight:bold;}
h2
	{mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-link:"Heading 2 Char";
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	mso-outline-level:2;
	font-size:18.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	font-weight:bold;}
h3
	{mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-link:"Heading 3 Char";
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	mso-outline-level:3;
	font-size:13.5pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	font-weight:bold;}
a:link, span.MsoHyperlink
	{mso-style-noshow:yes;
	mso-style-priority:99;
	color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-noshow:yes;
	mso-style-priority:99;
	color:purple;
	text-decoration:underline;
	text-underline:single;}
p
	{mso-style-noshow:yes;
	mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";}
pre
	{mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-link:"HTML Preformatted Char";
	margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
	font-size:10.0pt;
	font-family:"Courier New";
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;}
span.Heading1Char
	{mso-style-name:"Heading 1 Char";
	mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:"Heading 1";
	mso-ansi-font-size:24.0pt;
	mso-bidi-font-size:24.0pt;
	font-family:"Cambria","serif";
	mso-ascii-font-family:Cambria;
	mso-ascii-theme-font:major-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Cambria;
	mso-hansi-theme-font:major-latin;
	mso-font-kerning:18.0pt;
	font-weight:bold;}
span.Heading2Char
	{mso-style-name:"Heading 2 Char";
	mso-style-noshow:yes;
	mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:"Heading 2";
	font-family:"Cambria","serif";
	mso-ascii-font-family:Cambria;
	mso-hansi-font-family:Cambria;
	color:#4F81BD;
	font-weight:bold;}
span.Heading3Char
	{mso-style-name:"Heading 3 Char";
	mso-style-noshow:yes;
	mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:"Heading 3";
	font-family:"Cambria","serif";
	mso-ascii-font-family:Cambria;
	mso-hansi-font-family:Cambria;
	color:#4F81BD;
	font-weight:bold;}
span.HTMLPreformattedChar
	{mso-style-name:"HTML Preformatted Char";
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:"HTML Preformatted";
	font-family:Consolas;
	mso-ascii-font-family:Consolas;
	mso-hansi-font-family:Consolas;}
p.msochpdefault, li.msochpdefault, div.msochpdefault
	{mso-style-name:msochpdefault;
	mso-style-unhide:no;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";}
span.SpellE
	{mso-style-name:"";
	mso-spl-e:yes;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	font-size:10.0pt;
	mso-ansi-font-size:10.0pt;
	mso-bidi-font-size:10.0pt;}
@page Section1
	{size:595.3pt 841.9pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;
	mso-header-margin:35.4pt;
	mso-footer-margin:35.4pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:662510229;
	mso-list-template-ids:68166600;}
@list l0:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l1
	{mso-list-id:1086195567;
	mso-list-template-ids:-640936278;}
@list l1:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l2
	{mso-list-id:1173177797;
	mso-list-template-ids:-652283958;}
@list l2:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l3
	{mso-list-id:1194339911;
	mso-list-template-ids:566151792;}
@list l3:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l4
	{mso-list-id:1471509613;
	mso-list-template-ids:1897414450;}
@list l4:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l5
	{mso-list-id:1899972933;
	mso-list-template-ids:1573794646;}
@list l5:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l6
	{mso-list-id:2044986699;
	mso-list-template-ids:-1636242998;}
@list l6:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
@list l7
	{mso-list-id:2080203268;
	mso-list-template-ids:38184230;}
@list l7:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	mso-ansi-font-size:10.0pt;
	font-family:Symbol;}
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman","serif";}
</style>
<![endif]--><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="2050"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1"/>
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-GB link=blue vlink=purple style='tab-interval:36.0pt'>

<div class=Section1>

<h1><span style='mso-fareast-font-family:"Times New Roman"'>Containers <o:p></o:p></span></h1>

<p>Containers are <span class=SpellE><i>vars</i></span><i> </i>containing
collections of values.&nbsp; Containers are used for</p>

<ul style='margin-top:0cm' type=disc>
 <li class=MsoNormal style='mso-list:l6 level1 lfo1;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>arrays (vectors)<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l6 level1 lfo1;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>lists (doubly-linked
     lists)<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l6 level1 lfo1;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>sets<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l6 level1 lfo1;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>strings<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l6 level1 lfo1;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>objects <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l6 level1 lfo1;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>maps (also known as
     dictionaries) <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l6 level1 lfo1;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>ranges <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l6 level1 lfo1;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>transforming containers <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l6 level1 lfo1;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>filter containers <o:p></o:p></span></li>
</ul>

<p>C++Script containers are C++ containers that are <span class=SpellE><i>vars</i></span>,
and contain <i>var</i>s. </p>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Arrays <o:p></o:p></span></h2>

<p>An array is a list of values, where each value can be referenced by a
position.&nbsp; Use arrays</p>

<ul style='margin-top:0cm' type=disc>
 <li class=MsoNormal style='mso-list:l2 level1 lfo2;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>When you have a list of
     items <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l2 level1 lfo2;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>When you need to access
     items by numerical index <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l2 level1 lfo2;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>When you need to
     implement a LIFO stack <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l2 level1 lfo2;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>When you don't need to
     remove items from the front or middle of the list <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l2 level1 lfo2;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>When you don't need to
     search for items <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l2 level1 lfo2;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>When your numerical
     indexes are close together or continuous<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l2 level1 lfo2;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>As your default
     container<o:p></o:p></span></li>
</ul>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>Creating arrays<o:p></o:p></span></h3>

<p>Arrays are created using the <span class=GramE><i>array(</i></span><i>)</i>
function to create an empty array:</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> a = array();</pre></blockquote>

<p>Passing arguments to the <span class=GramE><i>array(</i></span><i>)</i>
function creates an array of with the given elements.&nbsp; <span class=GramE>E.g.</span></p>

<p style='margin-left:36.0pt'><span style='font-size:10.0pt;font-family:"Courier New"'>a
= <span class=GramE>array(</span>1,2,3);</span></p>

<p>The bracket operator appends items to an array:</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> b = array(1)(2)(3);</pre><pre><span
class=SpellE><span class=GramE>var</span></span> c = array(&quot;this&quot;)(&quot;is&quot;)(&quot;an&quot;)(&quot;array&quot;);</pre></blockquote>

<p>What's happening here is that when you call an array <span class=SpellE><i>var</i></span><i>
</i>as a <span class=SpellE>functor</span>, then that value is appended to the
array.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
<br>
An array can be initialized to a given size with a single value, using&nbsp;<span
class=SpellE><i>fill_<span class=GramE>array</span></i></span><span
class=GramE><i>(</i></span><i>)</i> e.g.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> a = <span class=SpellE>fill_array</span>(20, &quot;&quot;); // An array of 20 empty strings</pre></blockquote>

<p>The <span class=SpellE><i>array_<span class=GramE>from</span></i></span><span
class=GramE><i>(</i></span><i>)</i> function converts another container (such
as a string or a list) into an array.</p>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>Using arrays<o:p></o:p></span></h3>

<p>Items can be created, updated and retrieved from arrays using square-bracket
notation.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> a = array();</pre><pre><span
class=GramE>a[</span>0] = &quot;dog&quot;;</pre><pre><span class=GramE>a[</span>&quot;1&quot;] = &quot;cat&quot;;</pre><pre><span
class=GramE>a[</span>2] = &quot;mouse&quot;;</pre><pre>&nbsp;</pre><pre><span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span>a[1]); // Output: cat</pre><pre><span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span><span
class=SpellE>a.size</span>()); // Output: 3</pre></blockquote>

<p>The size of the array does not need to be specified up front, since the
array will automatically resize as items are added.&nbsp; If you set an item
beyond the end of the array, then the intermediate values are set to <i>null.</i></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> a = array();</pre><pre><span
class=GramE>a[</span>100] = 12;</pre><pre><span class=SpellE><span class=GramE>writeln</span></span><span
class=GramE>(</span>a[10]); // null</pre><pre><span class=SpellE><span
class=GramE>writeln</span></span><span class=GramE>(</span><span class=SpellE>a.size</span>()); // 101</pre></blockquote>

<p>If you retrieve an item that has not been assigned, or an item is retrieved
beyond the end of the array, then the <i>null</i> value is returned without
error.<br>
<br>
The first item in the array has an index of 0.&nbsp; If the index is negative,
then the index is counted from the back (i.e. <span class=GramE>array[</span>-1]
refers to the last item in the array).<br>
<br>
The number of items in the array is retrieved using the <span class=GramE><i>size(</i></span><i>)</i>
method.&nbsp; The <span class=GramE><i>empty(</i></span><i>)</i> method returns
whether the array is empty.&nbsp; An array converts to true if it is non-empty.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=GramE>if(</span>a) <span class=SpellE>writeln</span>(&quot;a is non-empty&quot;);</pre></blockquote>

<p>When written as a string, the array displays the contents in square
brackets.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span>a);</pre></blockquote>

<p>The <span class=GramE><i>front(</i></span><i>)</i> and <i>back()</i> methods
return the first and the last members of the array respectively.&nbsp; They are
equivalent to <span class=GramE><i>a[</i></span><i>0]</i> and <i>a[-1]</i>
respectively.&nbsp; If the array is empty, then <span class=GramE><i>front(</i></span><i>)</i>
and <i>back()</i> return <i>null </i>is returned without error.</p>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>Modifying arrays<o:p></o:p></span></h3>

<p>Items can be added and removed from the end of the array, using the <span
class=SpellE><i>push_<span class=GramE>back</span></i></span><span class=GramE><i>(</i></span><i>)</i>
and <span class=SpellE><i>pop_back</i></span><i>()</i> methods
respectively.&nbsp; <span class=SpellE><i>pop_<span class=GramE>back</span></i></span><span
class=GramE><i>(</i></span><i>)</i> returns the item that was removed, or <i>null
</i>if the array is empty.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> a = array();</pre><pre><span
class=SpellE>a.push_<span class=GramE>back</span></span><span class=GramE>(</span>10);</pre><pre><span
class=SpellE>a.push_<span class=GramE>back</span></span><span class=GramE>(</span>9);</pre><pre><span
class=SpellE>a.push_<span class=GramE>back</span></span><span class=GramE>(</span>8);</pre><pre><span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span><span
class=SpellE>a.pop_back</span>()); // 8</pre><pre><span class=SpellE><span
class=GramE>writeln</span></span><span class=GramE>(</span><span class=SpellE>a.pop_back</span>()); // 9</pre><pre><span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span><span
class=SpellE>a.pop_back</span>()); // 10</pre><pre><span class=SpellE><span
class=GramE>writeln</span></span><span class=GramE>(</span><span class=SpellE>a.pop_back</span>()); // null</pre></blockquote>

<p>The <span class=GramE><i>clear(</i></span><i>)</i> method erases all items
in the array.&nbsp; The <span class=GramE><i>erase(</i></span><i>)</i> method
erases a particular item, or a range of items.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> a = array('<span class=SpellE>a','b','c','d','e','f</span>');</pre><pre><span
class=SpellE><span class=GramE>a.erase</span></span><span class=GramE>(</span> range(1,3) );</pre><pre><span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span>a); // [<span
class=SpellE>a,e,f</span>]</pre></blockquote>

<p>Like all <span class=SpellE>vars</span>, the unary + operator <span
class=GramE>clones</span> the array.&nbsp; This performs a &quot;shallow
copy&quot;.&nbsp; The binary + operator appends two arrays, and the * operator
repeats an array.&nbsp; The += operator appends one array to another, and the
*= operators repeats the array a specified number of times.&nbsp; <span
class=GramE>e.g.</span> </p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> a = array(2)(3)(4);</pre><pre><span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span> <span
class=SpellE>a+a</span> ); // [2,3,4,2,3,4]</pre><pre><span class=SpellE>writeln</span>( a*3 ); // [2,3,4,2,3,4,2,3,4]</pre></blockquote>

<p>The <span class=SpellE><i>var</i></span><i>::<span class=GramE>insert(</span>)</i>
method can be used to insert an array of items into another array.&nbsp; The
first argument to <span class=GramE><i>insert(</i></span><i>)</i> is the
position that the item is inserted, and the second argument is an item to be
inserted.</p>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Lists <o:p></o:p></span></h2>

<p>A list (or linked list) stores a sequence of values.&nbsp; It is efficient
to insert and delete items in the list, but it is not possible to look up an
item at a particular index.&nbsp; This is the opposite of an array (where it is
very fast to look up a particular item, and slow to insert or delete from
anywhere other than the end).&nbsp; Lists are useful where</p>

<ul style='margin-top:0cm' type=disc>
 <li class=MsoNormal style='mso-list:l4 level1 lfo3;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>You need to insert or
     delete items from either end of the list <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l4 level1 lfo3;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>You don't need to look
     up an item by numerical index<o:p></o:p></span></li>
</ul>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>Creating lists<o:p></o:p></span></h3>

<p>Lists can be created in the following ways:</p>

<ul style='margin-top:0cm' type=disc>
 <li class=MsoNormal style='mso-list:l5 level1 lfo4;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>An empty list is created
     using the <span class=GramE><i>list(</i></span><i>)</i> function with no
     arguments.<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l5 level1 lfo4;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>Passing up to ten
     arguments to the <span class=GramE><i>list(</i></span><i>)</i> function to
     initialize the list with the given elements.<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l5 level1 lfo4;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>From another container
     passed to the <span class=SpellE><i>list_<span class=GramE>from</span></i></span><span
     class=GramE><i>(</i></span><i>)</i> function to convert the other
     container to a list.<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l5 level1 lfo4;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>The <span class=SpellE><i>fill_<span
     class=GramE>list</span></i></span><span class=GramE><i>(</i></span><i>)</i>
     function to create a list with the same element repeated a number of
     times.<o:p></o:p></span></li>
</ul>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>&nbsp;</pre><pre><span
lang=SV style='mso-ansi-language:SV'>var l1 = list(); // Empty list<o:p></o:p></span></pre><pre><span
lang=SV style='mso-ansi-language:SV'>var l3 = list(1)(2)(3)(&quot;horse&quot;);<o:p></o:p></span></pre><pre><span
class=SpellE><span class=GramE>var</span></span> l4 = list(1,2,3,&quot;horse&quot;);</pre><pre><span
class=SpellE><span class=GramE>var</span></span> l5 = <span class=SpellE>fill_list</span>(10, &quot;a&quot;) // The string &quot;a&quot; repeated 10 times</pre></blockquote>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>Using lists<o:p></o:p></span></h3>

<p>The <span class=GramE><i>size(</i></span><i>)</i> method returns the number
of items in the list, and the empty() method returns whether the list is empty
(<i>size() != 0</i>).&nbsp; Converting to a <span class=SpellE>bool</span> (or <span
class=SpellE><i>var</i></span><i>::<span class=SpellE>as_<span class=GramE>bool</span></span><span
class=GramE>(</span>)</i>) returns true if the list is non-empty.&nbsp;
Converted to a string, the list is written as a comma-separated list in square
brackets.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=GramE>assert(</span> !l1 );</pre><pre><span class=SpellE><span
class=GramE>writeln</span></span><span class=GramE>(</span> items ); // [1,2,3,pony]</pre><pre><span
class=GramE>assert(</span> l2.size() == 4 );</pre></blockquote>

<p>The <span class=GramE><i>front(</i></span><i>)</i> and <i>back()</i> methods
return the first and last member in the list respectively.&nbsp; If the list is
empty, then the methods return null but there is no error.</p>

<p>Lists do not have a [] operator to access individual members of the list.</p>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>Modifying Lists<o:p></o:p></span></h3>

<p>The <span class=SpellE><i>push_<span class=GramE>front</span></i></span><span
class=GramE><i>(</i></span><i>)</i> and <span class=SpellE><i>push_back</i></span><i>()</i>
methods add an item to either end of the list.&nbsp; The <span class=SpellE><i>pop_<span
class=GramE>front</span></i></span><span class=GramE><i>(</i></span><i>)</i>
and <span class=SpellE><i>pop_back</i></span><i>()</i> methods remove an item
from either end of the list, and return the removed value.&nbsp; If the list is
empty, the <span class=SpellE><i>pop_<span class=GramE>front</span></i></span><span
class=GramE><i>(</i></span><i>)</i> and <span class=SpellE><i>pop_back</i></span><i>()</i>
return null.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> l = list();</pre><pre><span
class=SpellE>l.push_<span class=GramE>back</span></span><span class=GramE>(</span>1);</pre><pre><span
class=SpellE>l.push_<span class=GramE>back</span></span><span class=GramE>(</span>2);</pre><pre><span
class=SpellE>l.push_<span class=GramE>back</span></span><span class=GramE>(</span>3);</pre><pre><span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span><span
class=SpellE>l.front</span>()); // 1</pre><pre><span class=SpellE><span
class=GramE>writeln</span></span><span class=GramE>(</span><span class=SpellE>l.pop_back</span>()); // 3</pre><pre><span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span>l); // [1,2]</pre></blockquote>

<p>The <span class=GramE><i>clear(</i></span><i>)</i> method removes all items
from the list.</p>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>List operators<o:p></o:p></span></h3>

<p>The + operator joins two lists (the second operand can be any container),
and the * operator repeats the list the specified number of times.&nbsp; The +=
operator appends a container to the list, and the *= operator repeats the
list.&nbsp; <span lang=SV style='mso-ansi-language:SV'>e.g.<o:p></o:p></span></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span lang=SV
style='mso-ansi-language:SV'>var l = list(1,2,3,4);<o:p></o:p></span></pre><pre><span
lang=SV style='mso-ansi-language:SV'>writeln(l + array(5,6,7)); // [1,2,3,4,5,6,7]<o:p></o:p></span></pre><pre><span
lang=SV style='mso-ansi-language:SV'>writeln(l * 2); // [1,2,3,4,1,2,3,4]<o:p></o:p></span></pre><pre>l+=<span
class=GramE>list(</span>'a'); // [1,2,3,4,a]</pre><pre>l*=2; // [1,2,3,4,a,1,2,3,4,a]</pre></blockquote>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Sets<o:p></o:p></span></h2>

<p>A set is a list where each member is unique.&nbsp; Sets store their members
in order.&nbsp; There is no numerical index, <span class=SpellE><i>push_<span
class=GramE>front</span></i></span><span class=GramE><i>(</i></span><i>), <span
class=SpellE>push_back</span>(), <span class=SpellE>pop_front</span>() </i>or<i>
<span class=SpellE>pop_back</span>().</i></p>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>Creating sets<o:p></o:p></span></h3>

<p>Sets are created using the functions <span class=GramE><i>set(</i></span><i>)</i>
and <span class=SpellE><i>set_from</i></span><i>()</i>.&nbsp; The <span
class=GramE><i>set(</i></span><i>)</i> function creates an empty set, and
arguments passed to the set() function create a set with the given
members.&nbsp; The () operator inserts items into the set.&nbsp; <span
class=SpellE><i>set_<span class=GramE>from</span></i></span><span class=GramE><i>(</i></span><i>)</i>
converts another container into a set.&nbsp; <span class=GramE>e.g.</span></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> s1 = set(); // Empty set</pre><pre><span
class=SpellE><span class=GramE>var</span></span> s2 = set(3)(2)(1)(3); // Set of 1,2,3 </pre><pre><span
class=SpellE><span class=GramE>var</span></span> s3 = set(3,2,1,3); // Set of 1,2,3 </pre></blockquote>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>Using sets<o:p></o:p></span></h3>

<p>Like all containers, <span class=SpellE><i>var</i></span><i>::<span
class=GramE>size(</span>)</i> returns the number of items in the set.&nbsp; <span
class=SpellE><i>var</i></span><i>::<span class=GramE>empty(</span>)</i> returns
true if the set is empty, and <span class=SpellE><i>var</i></span><i>::clear()</i>
removes all items from the set.&nbsp; Values are inserted into a set using <span
class=SpellE>var</span>::<span class=GramE>insert(</span>), and removed using <span
class=SpellE><i>var</i></span><i>::erase()</i>.&nbsp; The <span class=SpellE><i>var</i></span><i>::<span
class=GramE>contains(</span>)</i> method returns true if the set contains a
particular item.&nbsp; e.g. (<a href="set.cpp">set.cpp</a>)</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>#include &lt;<span
class=SpellE>cppscript</span>&gt;</pre><pre>&nbsp;</pre><pre><span
class=SpellE><span class=GramE>var</span></span> <span class=SpellE>script_main</span>(<span
class=SpellE>var</span>)</pre><pre>{</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=SpellE><span class=GramE>var</span></span> s1 = set();</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=GramE>s1.insert(</span>1);</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=GramE>s1.insert(</span>2);</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=GramE>s1.insert(</span>3);</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span> s1.contains(2) ); // true</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=GramE>s1.erase(</span>2);</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span> s1.contains(2) ); // false</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=GramE>return</span> 0;</pre><pre>}</pre></blockquote>

<p class=MsoNormal>The set operator + performs the union of two sets, * the
intersection, and - the set difference. </p>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Maps <o:p></o:p></span></h2>

<p>A map (called a dictionary in Python) associates two different values,
called keys and values, where a value is stored with each key.&nbsp; Use maps
when</p>

<ul style='margin-top:0cm' type=disc>
 <li class=MsoNormal style='mso-list:l0 level1 lfo5;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>You have pairs of
     associated data <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo5;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>You need to look up data
     efficiently<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo5;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>You need to index data<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo5;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>You have a sparse set of
     keys (i.e. not in a small numeric range, in which case an array could be
     better)<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo5;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>Keys are non-numeric<o:p></o:p></span></li>
</ul>

<p>Maps can compare any type of value provided that they are comparable.&nbsp;
Note that integers always compare lower to doubles, which compare lower to
strings etc.</p>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>Creating maps<o:p></o:p></span></h3>

<p>Maps are created using the <span class=GramE><i>map(</i></span><i>)</i>
function.&nbsp;</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span lang=SV
style='mso-ansi-language:SV'>var m = map();<o:p></o:p></span></pre><pre><span
lang=SV style='mso-ansi-language:SV'>var m = map(1,&quot;dog&quot;)(2,&quot;cat&quot;);<o:p></o:p></span></pre></blockquote>

<h3><span style='mso-fareast-font-family:"Times New Roman"'>Using maps<o:p></o:p></span></h3>

<p>The <span class=GramE><i>size(</i></span><i>)</i> method returns the number
of entries in the map, and the <i>empty()</i> method returns true if the map is
empty.&nbsp; A map converted to a <span class=SpellE>bool</span> is true when
the map is non-empty.&nbsp; The string form of a map lists the items in the
map.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span lang=SV
style='mso-ansi-language:SV'>var m = map();<o:p></o:p></span></pre><pre><span
lang=SV style='mso-ansi-language:SV'>assert( !m );<o:p></o:p></span></pre></blockquote>

<p>The square brackets operator is used to get and set items in the map.&nbsp;
If you assign to an item in the map that doesn't exist, the item is created.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> <span class=SpellE>pet_age</span> = map();</pre><pre><span
class=SpellE>pet_<span class=GramE>age</span></span><span class=GramE>[</span>&quot;<span
class=SpellE>sammy</span>&quot;] = 4;</pre><pre><span class=SpellE>pet_<span
class=GramE>age</span></span><span class=GramE>[</span>&quot;<span
class=SpellE>necrox</span>&quot;] = 6.66;</pre><pre><span class=GramE>assert(</span> <span
class=SpellE>pet_age</span>[&quot;<span class=SpellE>sammy</span>&quot;] == 4 );</pre></blockquote>

<p>The keys in a map can be iterated using <span class=SpellE><i>foreach</i></span><i>.</i></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>foreach</span></span><span class=GramE>(</span> pet, <span
class=SpellE>pet_age</span> )</pre><pre>&nbsp;&nbsp;&nbsp; <span class=SpellE><span
class=GramE>writeln</span></span><span class=GramE>(</span> pet + &quot; is &quot; + <span
class=SpellE>pet_age</span>[pet] );</pre></blockquote>

<p>The values can be iterated using the <span class=GramE><i>values(</i></span><i>)</i>
function to iterate values instead of keys:</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>foreach</span></span><span class=GramE>(</span> age, <span
class=SpellE>pet_age.values</span>() )</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span>age);</pre></blockquote>

<p>If you retrieve a non-existent item in a map, the result is <i>null.</i>&nbsp;
Items can be erased from a map using the <span class=GramE><i>erase(</i></span><i>)</i>
method, and the presence of a key can be tested using the <i>contains()</i>
method.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> m = map();</pre><pre><span
class=GramE>assert(</span> !<span class=SpellE>m.contains</span>(1) );</pre><pre><span
class=GramE>m[</span>1] = 12;</pre><pre><span class=GramE>assert(</span> <span
class=SpellE>m.contains</span>(1) );</pre><pre><span class=SpellE><span
class=GramE>m.erase</span></span><span class=GramE>(</span>1);</pre><pre><span
class=GramE>assert(</span> !<span class=SpellE>m.contains</span>(1) );</pre></blockquote>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Comparing
containers<o:p></o:p></span></h2>

<p>With the exception of strings (which are compared in <span class=SpellE>lexographical</span>
order), containers are compared based only on whether they are the same
object.&nbsp; The ordering of containers is consistent (fully ordered), so they
can be used as keys in maps.&nbsp; The reason for this is because the
comparison operator needs to be efficient and not go into an infinite loop.</p>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Enumerating
containers <o:p></o:p></span></h2>

<p>The <span class=SpellE><i>foreach</i></span><i> </i>macro repeats a block of
code for each item in a container.&nbsp; Use <span class=SpellE><i>foreach</i></span></p>

<ul style='margin-top:0cm' type=disc>
 <li class=MsoNormal style='mso-list:l3 level1 lfo6;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>To perform an action for
     every item in a container <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l3 level1 lfo6;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>To search a container<o:p></o:p></span></li>
</ul>

<p>The syntax is</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>foreach</span></span><span class=GramE>(</span> v, container )</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=GramE>body</span> of loop</pre></blockquote>

<p>Where v is the loop variable, and container is the container to be
iterated.&nbsp; The body of the loop is normally enclosed in curly brackets,
which can be omitted if there is just a single statement in the loop.&nbsp; <span
class=GramE>e.g.</span></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>foreach</span></span><span class=GramE>(</span> <span
class=SpellE>i</span>, array(1,2,3) )</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span><span
class=SpellE>i</span>);</pre></blockquote>

<p>Arrays, sets, lists and strings iterate through the values in the
container.&nbsp;<br>
<br>
If you wish to iterate the keys (indexes) in the array, the<i> <span
class=GramE>keys(</span>) </i>method retrieves the keys instead of the
values.&nbsp; The following are equivalent:</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>foreach</span></span><span class=GramE>(</span> <span
class=SpellE>i</span>, a ) <span class=SpellE>writeln</span>(<span
class=SpellE>i</span>);</pre><pre><span class=SpellE><span class=GramE>foreach</span></span><span
class=GramE>(</span> <span class=SpellE>i</span>, <span class=SpellE>a.keys</span>() ) <span
class=SpellE>writeln</span>(a[<span class=SpellE>i</span>]);</pre></blockquote>

<p>Maps and objects iterate through the keys of the container.&nbsp; <span
lang=SV style='mso-ansi-language:SV'>e.g.<o:p></o:p></span></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span lang=SV
style='mso-ansi-language:SV'>var m = map();<o:p></o:p></span></pre><pre><span
lang=SV style='mso-ansi-language:SV'>m[1] = 2;<o:p></o:p></span></pre><pre><span
class=GramE>m[</span>2] = 3;</pre><pre>&nbsp;</pre><pre><span class=SpellE><span
class=GramE>foreach</span></span><span class=GramE>(</span> <span class=SpellE>i</span>, m )</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span> &quot;The value of &quot; + <span
class=SpellE>i</span> + &quot; is &quot; + m[<span class=SpellE>i</span>] );</pre></blockquote>

<p>The values of a map can be iterated directly using the <span class=GramE><i>values(</i></span><i>)</i>
method.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> m = map();</pre><pre><span
class=GramE>m[</span>1] = 2;</pre><pre><span class=GramE>m[</span>2] = 3;</pre><pre>&nbsp;</pre><pre><span
class=SpellE><span class=GramE>foreach</span></span><span class=GramE>(</span> <span
class=SpellE>i</span>, <span class=SpellE>m.values</span>() )</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span> <span
class=SpellE>i</span> ); // 2, 3</pre></blockquote>

<p>The C++ container methods (<span class=GramE><i>begin(</i></span><i>),
end(), <span class=SpellE>rbegin</span>(), rend()</i> etc) are also available.<br>
<br>
<span class=SpellE>Iterators</span> are intended to be short-lived.&nbsp; <span
class=SpellE>Iterators</span> cannot be stored as members of other
containers.&nbsp; If an <span class=SpellE>iterator</span> detects that its
underlying object has changed, then the <span class=SpellE>iterator</span>
throws the exception <i>&quot;<span class=SpellE>expired_iterator</span></i>&quot;.</p>

<h2><a name=Ranges></a><a name=range></a><span style='mso-fareast-font-family:
"Times New Roman"'>Ranges<o:p></o:p></span></h2>

<p>A range is a special kind of container containing a linear sequence of
numbers.&nbsp; The six functions to create ranges are:</p>

<ul style='margin-top:0cm' type=disc>
 <li class=MsoNormal style='mso-list:l7 level1 lfo7;tab-stops:list 36.0pt'><span
     class=SpellE><span class=GramE><i><span style='mso-fareast-font-family:
     "Times New Roman"'>var</span></i></span></span><i><span style='mso-fareast-font-family:
     "Times New Roman"'> range(<span class=SpellE>var</span> from, <span
     class=SpellE>var</span> to)</span></i><span style='mso-fareast-font-family:
     "Times New Roman"'> returns an inclusive range between the numbers [from..<span
     class=GramE>to</span>].&nbsp; If <span class=SpellE><i>to</i></span><i> </i><span
     class=GramE>is</span> less than <i>from,</i> then the sequence is
     descending.<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l7 level1 lfo7;tab-stops:list 36.0pt'><span
     class=SpellE><span class=GramE><i><span style='mso-fareast-font-family:
     "Times New Roman"'>var</span></i></span></span><i><span style='mso-fareast-font-family:
     "Times New Roman"'> range(<span class=SpellE>var</span> from, <span
     class=SpellE>var</span> to, <span class=SpellE>var</span> step)</span></i><span
     style='mso-fareast-font-family:"Times New Roman"'> returns an inclusive
     range [from, <span class=SpellE>from+step</span>, from + 2*step, ...,
     to].&nbsp; If <span class=SpellE><i>to</i></span><i> </i><span
     class=GramE>is</span> less than <i>from,</i> then the sequence is
     descending.<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l7 level1 lfo7;tab-stops:list 36.0pt'><span
     class=SpellE><span class=GramE><i><span style='mso-fareast-font-family:
     "Times New Roman"'>var</span></i></span></span><i><span style='mso-fareast-font-family:
     "Times New Roman"'> <span class=SpellE>range_ex</span>(<span class=SpellE>var</span>
     from, <span class=SpellE>var</span> to)</span></i><span style='mso-fareast-font-family:
     "Times New Roman"'> returns an exclusive range between the numbers [from..<span
     class=GramE>to</span>).&nbsp; If <span class=SpellE><i>to</i></span><i> </i><span
     class=GramE>is</span> less than <i>from,</i> then the sequence is
     descending.<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l7 level1 lfo7;tab-stops:list 36.0pt'><span
     class=SpellE><span class=GramE><i><span style='mso-fareast-font-family:
     "Times New Roman"'>var</span></i></span></span><i><span style='mso-fareast-font-family:
     "Times New Roman"'> <span class=SpellE>range_ex</span>(<span class=SpellE>var</span>
     from, <span class=SpellE>var</span> to, <span class=SpellE>var</span>
     step)</span></i><span style='mso-fareast-font-family:"Times New Roman"'>
     returns an exclusive range [from, <span class=SpellE>from+step</span>,
     from + 2*step, ..., to).&nbsp; If <span class=SpellE><i>to</i></span><i> </i><span
     class=GramE>is</span> less than <i>from,</i> then the sequence is
     descending.<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l7 level1 lfo7;tab-stops:list 36.0pt'><span
     class=SpellE><span class=GramE><i><span style='mso-fareast-font-family:
     "Times New Roman"'>var</span></i></span></span><i><span style='mso-fareast-font-family:
     "Times New Roman"'> sequence(<span class=SpellE>var</span> from, <span
     class=SpellE>var</span> size)</span></i><span style='mso-fareast-font-family:
     "Times New Roman"'> returns an exclusive range between [from..<span
     class=SpellE><span class=GramE>from+</span>size</span>).&nbsp; If <span
     class=SpellE><i>to</i></span><i> </i><span class=GramE>is</span> less than
     <i>from,</i> then the sequence is descending.<o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l7 level1 lfo7;tab-stops:list 36.0pt'><span
     class=SpellE><span class=GramE><i><span style='mso-fareast-font-family:
     "Times New Roman"'>var</span></i></span></span><i><span style='mso-fareast-font-family:
     "Times New Roman"'> sequence(<span class=SpellE>var</span> from, <span
     class=SpellE>var</span> size, <span class=SpellE>var</span> step)</span></i><span
     style='mso-fareast-font-family:"Times New Roman"'> returns an exclusive
     range between [from, <span class=SpellE>from+step</span>, from+2*step,..<span
     class=SpellE>from+step</span>*size)<o:p></o:p></span></li>
</ul>

<p>See <a href="range1.cpp">range1.cpp</a> for an example.</p>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Converting between
different containers<o:p></o:p></span></h2>

<p>The<span class=GramE>&nbsp; functions</span> <span class=SpellE><i>array_from</i></span><i>()</i>,
<span class=SpellE><i>list_from</i></span><i>()</i>, <span class=SpellE><i>string_from</i></span><i>()</i>
and<i> <span class=SpellE>set_from</span>(</i>), can be used to convert between
containers of different types.&nbsp; <span class=GramE>e.g.</span></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> <span class=SpellE>items_array</span> = array(&quot;1&quot;,&quot;2&quot;,&quot;3&quot;);</pre><pre><span
class=SpellE><span class=GramE>var</span></span> <span class=SpellE>items_list</span> = <span
class=SpellE>list_from</span>(<span class=SpellE>items_array</span>);</pre><pre><span
class=SpellE><span class=GramE>var</span></span> <span class=SpellE>items_string</span> = <span
class=SpellE>string_from</span>(<span class=SpellE>items_list</span>);</pre></blockquote>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Transform <o:p></o:p></span></h2>

<p>The <span class=GramE><i>transform(</i></span><i>)</i> function transforms
the values of the container.&nbsp; The <span class=GramE><i>transform(</i></span><i>)</i>
function doesn't create a copy or alter the original container.&nbsp; Use
transform where</p>

<ul style='margin-top:0cm' type=disc>
 <li class=MsoNormal style='mso-list:l1 level1 lfo8;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>The container contains
     values in one format, but you need to modify the values to another format <o:p></o:p></span></li>
 <li class=MsoNormal style='mso-list:l1 level1 lfo8;tab-stops:list 36.0pt'><span
     style='mso-fareast-font-family:"Times New Roman"'>You need to
     systematically alter the values in a container <o:p></o:p></span></li>
</ul>

<p>The transform function takes two arguments: the container to be transformed,
and a <span class=SpellE>functor</span> which transforms each value.&nbsp; <span
class=GramE>e.g.</span></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> times_2(<span class=SpellE>var</span> a) { return a*2; }</pre><pre>&nbsp;</pre><pre><span
class=SpellE><span class=GramE>foreach</span></span><span class=GramE>(</span> <span
class=SpellE>i</span>, transform( range(1, 10), times_2 ) )</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span><span
class=SpellE>i</span>);</pre></blockquote>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Filter <o:p></o:p></span></h2>

<p>The <span class=GramE><i>filter(</i></span><i>)</i> function creates a
container from another container with certain values removed.&nbsp; The <span
class=GramE><i>filter(</i></span><i>)</i> function doesn't copy the values or
alter the original container.&nbsp; Use <span class=GramE><i>filter(</i></span><i>)</i>
where you need to iterate over some (but not all) items in a container.</p>

<p>The <span class=GramE><i>filter(</i></span><i>)</i> function takes two
arguments: the container to be transformed, and a <span class=SpellE>functor</span>
which returns true or false.&nbsp; <span class=GramE>e.g.</span></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>foreach</span></span><span class=GramE>(</span> p, filter( range(2, 100), <span
class=SpellE>is_prime</span> ) )</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span> <span
class=SpellE>p.as_string</span>() + &quot; is prime&quot; );</pre></blockquote>

<p>The filtered result can be copied into another container as follows</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE><span class=GramE>var</span></span> primes = <span class=SpellE>array_from</span>( filter( range(2, 100), <span
class=SpellE>is_prime</span> ) );</pre></blockquote>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Reverse<o:p></o:p></span></h2>

<p>A container can be iterated in reverse using the <span class=GramE><i>reverse(</i></span><i>)</i>
function.&nbsp; <span class=GramE><i>reverse(</i></span><i>)</i> doesn't copy
data, it merely causes the data to be iterated in reverse order.</p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre><span
class=SpellE>foreach</span>( <span class=SpellE>i</span>, reverse( array(1,2,3) ) )</pre><pre>&nbsp;&nbsp;&nbsp; <span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span><span
class=SpellE>i</span>); </pre></blockquote>

<h2><span style='mso-fareast-font-family:"Times New Roman"'>Tail<o:p></o:p></span></h2>

<p class=MsoNormal>The <span class=GramE><i>tail(</i></span><i>)</i> function
enumerates all items in a container except the first element. &nbsp;The <span
class=GramE><i>tail(</i></span><i>)</i> function doesn't copy the data or alter
the original container. &nbsp;<span class=GramE>e.g.</span></p>

<pre style='margin-left:30.0pt'>&nbsp;</pre><pre style='margin-left:30.0pt'><span
class=SpellE><span class=GramE>foreach</span></span><span class=GramE>(</span> <span
class=SpellE>i</span>, tail(array(1,2,3)) ) </pre><pre style='margin-left:30.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;<span
class=SpellE><span class=GramE>writeln</span></span><span class=GramE>(</span><span
class=SpellE>i</span>); // 2 3</pre>

<p><span class=GramE><i>tail(</i></span><i>)</i> is not an efficient way to
enumerate a list (i.e. avoid <i>x=tail(x)</i> in a loop).</p>

</div>

</body>

</html>
